package com.changan.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 学生答题表
 * </p>
 *
 * @author NieChangan
 * @since 2025-09-03
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("student_answers")
public class StudentAnswers extends Model<StudentAnswers> {

    /**
     * ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 学生考试记录ID
     */
    @TableField("student_exam_id")
    private Integer studentExamId;

    /**
     * 题目ID
     */
    @TableField("question_id")
    private Integer questionId;

    /**
     * 学生答案
     */
    @TableField("answer")
    private String answer;

    /**
     * 是否正确：1-正确，0-错误
     */
    @TableField("is_correct")
    private Boolean correct;

    /**
     * 得分
     */
    @TableField("score")
    private BigDecimal score;

    @TableField("created_at")
    private LocalDateTime createdAt;

    @TableField("updated_at")
    private LocalDateTime updatedAt;

    @Override
    public Serializable pkVal() {
        return this.id;
    }
}
